<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .c1{
            width: 300px;
            height: 300px;
            background-color: red;
        }

        .c2{
            width: 500px;
            height: 500px;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <button type="button" onclick="change()">改变样式</button>
    <div class="c1" id="outer">
        dfdf
    </div>
    <script>
        function change(){
            //js获取dom - 根据class属性值 - 返回的是一个数组
            let div = document.getElementsByClassName("c1")[0];
            //行内添加style属性

            //不推荐的,js代码和css代码耦合在一起了.
            // div.style.width="500px";
            // div.style.height="500px";
            // div.style.backgroundColor="yellow";

            //js修改属性
            div.className="c2";
        }
    </script>
</body>
</html>